<?php

include 'confidential_settings.php';
// This include contains 5 variables:
//  - db_name: database name
//  - table_name_x: table name
//  - username: username
//  - password: password
//  - localhost: host name

$dbh=mysql_connect ($localhost, $username, $password) or die('Cannot connect to the database because: ' . mysql_error());

mysql_select_db ($db_name) or die(mysql_error()); 

$result = mysql_query("SELECT * FROM $table_name_gsc");
 
mysql_close($dbh);

while($row = mysql_fetch_array($result)){
	$tmp = $row['val']*4;
}

$tmp_perc = 100*$tmp/2250;

echo '<img src="http://chart.apis.google.com/chart?cht=gom&chd=t:';
echo $tmp_perc;
echo '&chs=500x250';
echo '&chl=';
echo $tmp;
echo 'W(';
echo (int)$tmp_perc;
echo '%)';
echo '" />';

?>
